
package kaizen.jdbc;

import kaizen.com.Sys;

public class dbRecord
{

  public dbRecord(int i)
  {
    li_fields = i;
    lsa_screen = new String[i];
    lsa_database = new String[i];
    li_status = 0;
    for (int j = 0; j < li_fields; j++)
    {
      lsa_screen[j] = "";
      lsa_database[j] = "";
    }

  }

  public String getField(int i)
  {
    String s = "";
    if (--i >= 0 && i < li_fields)
      s = lsa_screen[i];
    return s;
  }

  public int getFieldCount()
  {
    return li_fields;
  }

  public String getRow()
  {
    String s = Sys.getSeparator();
    String s1 = "";
    for (int i = 0; i < li_fields; i++)
    {
      s1 = s1 + lsa_screen[i];
      if (i < li_fields - 1)
        s1 = s1 + s;
    }

    return s1;
  }

  public void setField(int i, String s)
  {
    if (--i >= 0 && i < li_fields)
    {
      if (!lsa_database[i].equals(s))
        li_status = 3;
      lsa_screen[i] = s;
    }
  }

  public void setRecord(String s)
  {
    String s1 = Sys.getSeparator();
    for (int i = 1; s.indexOf(s1) != -1; i++)
    {
      setField(i, s.substring(0, s.indexOf(s1)));
      s = s.substring(s.indexOf(s1) + 1, s.length()).trim();
    }

  }

  public void setStatus(int i)
  {
    li_status = i;
  }

  String lsa_screen[];
  String lsa_database[];
  int li_status;
  int li_fields;
}
